import React, { Component } from 'react';
import { Icon } from 'antd';
import {connect} from "react-redux";
class HeaderToggle extends Component {
    state={};
    toggleBack = () => {
        //let top = document.documentElement.scrollTop;
            //top && (document.documentElement.scrollTop = 0);
        this.props.dispatch({type:'iconToggle'})
    };
    render() {
        return (
            <Icon onClick={this.toggleBack} type={this.props.collapsed ? 'menu-unfold' : 'menu-fold'} />
        );
    }
}

function mapStateToProps(state,ownProps) {
    return {
        collapsed: state.common.menuToggle,
    }
}
export default connect(mapStateToProps)(HeaderToggle);
